<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/public/common.jspf" %>
<html>
<head>
    <title>${id==null?"添加用户":"修改用户"}</title>

    <!--validateion-->
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/scripts/jquery_validate/jquery.validate.min.js"></script>
    <script type="text/javascript">
        //validate
        $(document).ready(function () {
            $('#addform').validate({
                rules: {
                    name: {
                        required: true,
                        maxlength: 255
                    },
                    description: {
                        maxlength: 255
                    }
                },
                messages: {
                    name: {
                        required: '请输入角色名',
                        maxlength: '角色名不超过255字符'
                    },
                    description: {
                        maxlength: '角色描述不超过255字符'
                    }
                }
            });
        });
    </script>
</head>
<body>
<div class="col-sm-9">
    <div class="row">
        <div class="col-lg-12">
            <div class="page-header">
                <h1>角色管理</h1>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default bootstrap-admin-no-table-panel">
                <div class="panel-heading">
                    <div class="text-muted bootstrap-admin-box-title">添加角色</div>
                </div>
                <div class="bootstrap-admin-no-table-panel-content bootstrap-admin-panel-content collapse in">
                    <s:form cssClass="form-horizontal" action="roleManage_%{id ==null?'add':'edit'}" id="addform">
                        <fieldset>
                            <legend>角色信息</legend>
                            <s:hidden name="id"></s:hidden>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">角色名称</label>

                                <div class="col-lg-10">
                                    <s:textfield cssClass="form-control" name="name"></s:textfield>
                                    <s:fielderror fieldName="name"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">角色描述</label>

                                <div class="col-lg-10">
                                    <s:textarea cssClass="form-control" rows="5" name="description"/>
                                    <s:fielderror fieldName="description"/>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-10 col-lg-offset-2">
                                    <button type="submit" class="btn btn-primary">保存</button>
                                    <s:a type="reset" cssClass="btn btn-default" action="roleManage_list">取消并返回列表</s:a>
                                </div>
                            </div>
                        </fieldset>
                    </s:form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
